7.7 Import Data from Database

MPL allows you import the elements for a datavector directly from a database. In the DATA section, where you define the datavector, enter the keyword DATABASE after the assignment symbol, followed by parentheses containing the table name and the column/field name you want to import from. Example:

     DATA
        FactDepCost[factory,depot] := DATABASE("FactDep","TrCost");

In the above example, MPL will open the database table FactDep, locate the columns TRCost, FactID, and DepotID, and then read in the entries for the data vector FactDepCost.

In some instances you do not want to read all the data elements that are in the table. In that case, you can enter the keyword WHERE followed by a condition on one of the columns. Here is an example:


     DATA
        FactDepCost[factory,depot] :=
           DATABASE("FactDep","TrCost" WHERE Region="NorthWest");

In this example we only want to read the transportation costs from the FactDep table where the Region column contains the entry NorthWest.

For further information on importing data vectors, please refer to Chapter 11.2: Import Data Vectors from Database.


Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page